package com.cesgroup.zw.spring.boot.library.echarts.bar.move;

import com.cesgroup.zw.spring.boot.echarts.build.EChartsOption;
import com.cesgroup.zw.spring.boot.echarts.component.Grid;
import com.cesgroup.zw.spring.boot.echarts.component.Legend;
import com.cesgroup.zw.spring.boot.echarts.component.TextStyle;
import com.cesgroup.zw.spring.boot.echarts.component.Tooltip;
import com.cesgroup.zw.spring.boot.echarts.component.axis.XAxis;
import com.cesgroup.zw.spring.boot.echarts.component.axis.YAxis;
import com.cesgroup.zw.spring.boot.echarts.component.zoom.DataZoom;
import com.cesgroup.zw.spring.boot.echarts.component.zoom.InsideDataZoom;
import com.cesgroup.zw.spring.boot.echarts.component.zoom.SliderDataZoom;
import com.cesgroup.zw.spring.boot.echarts.enums.AxisPointerType;
import com.cesgroup.zw.spring.boot.echarts.enums.AxisType;
import com.cesgroup.zw.spring.boot.echarts.enums.Trigger;
import com.cesgroup.zw.spring.boot.echarts.model.axis.AxisLabel;
import com.cesgroup.zw.spring.boot.echarts.model.axis.AxisLine;
import com.cesgroup.zw.spring.boot.echarts.model.axis.AxisPointer;
import com.cesgroup.zw.spring.boot.echarts.model.axis.SplitLine;
import com.cesgroup.zw.spring.boot.echarts.model.style.HandleStyle;
import com.cesgroup.zw.spring.boot.echarts.model.style.LineStyle;
import com.cesgroup.zw.spring.boot.echarts.model.style.RichTextStyle;

/**
 * <p>可移动柱状图</p>
 * @author ytj
 * @date 2019/7/8 9:47
 */
@SuppressWarnings("serial")
public class MoveBarOption extends EChartsOption {
    public MoveBarOption(MoveBarParam param){
        this.setBackgroundColor("#323a5e");
        this.setTooltip(new Tooltip(){{
            this.setTrigger(Trigger.axis);
            this.setAxisPointer(new AxisPointer(){{
                this.setType(AxisPointerType.shadow);
            }});
        }});
        this.setGrid(new Grid(){{
            this.setLeft("2%");
            this.setRight("4%");
            this.setBottom("14%");
            this.setTop("16%");
            this.setContainerLabel(true);
        }});
        this.setLegend(new Legend(){{
            this.setRight(10);
            this.setTop(12);
            this.setTextStyle(new RichTextStyle(){{
                this.setColor("#fff");
            }});
            this.setItemWidth(12);
            this.setItemHeight(10);
        }});
        this.setXAxis(new XAxis(){{
            this.setType(AxisType.category);
            this.setAxisLine(new AxisLine(){{
                this.setLineStyle(new LineStyle(){{
                    this.setColor("white");
                }});
            }});
            this.setAxisLabel(new AxisLabel(){{
                this.setFontFamily("Microsoft YaHei");
            }});
        }});
        this.setYAxis(new YAxis(){{
            this.setType(AxisType.value);
            this.setMax(1200);
            this.setAxisLine(new AxisLine(){{
                this.setShow(false);
                this.setLineStyle(new LineStyle(){{
                    this.setColor("white");
                }});
            }});
            this.setSplitLine(new SplitLine(){{
                this.setShow(true);
                this.setLineStyle(new LineStyle(){{
                    this.setColor("rgba(255,255,255,0.3)");
                }});
            }});
        }});
        this.setDataZoom(new SliderDataZoom(){{
            this.setShow(true);
            this.setXAxisIndex(0);
            this.setBottom("8%");
            this.setStart(10);
            this.setEnd(90);
            this.setHandleIcon("path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z");
            this.setHandleSize("110%");
            this.setHandleStyle(new HandleStyle(){{
                this.setColor("#d3dee5");
            }});
            this.setTextStyle(new TextStyle(){{
                this.setColor("#fff");
            }});
            this.setBorderColor("#90979c");
            this.setHeight(12);
        }},new SliderDataZoom(){{
            this.setType("inside");
            this.setShow(true);
            this.setHeight(15);
            this.setStart(1);
            this.setEnd(35);
        }});
    }
}
